import requst from '@/utils/requst'

export const UserRegisterService = ({ username, password, repassword }) => {
  return requst.post('/api/reg', { username, password, repassword })
}

export const UserLoginService = ({ username, password }) =>
  requst.post('/api/login', { username, password })

export const userGetInfoService = () => {
  return requst.get('/my/userinfo')
}

export const userUpdateInfoService = ({ id, nickname, email }) =>
  requst.put('/my/userinfo', { id, nickname, email })

export const userUpdateAvatarService = (avatar) =>
  requst.patch('/my/update/avatar', { avatar })

export const userUpdatePasswordService = ({ old_pwd, new_pwd, re_pwd }) =>
  requst.patch('/my/updatepwd', { old_pwd, new_pwd, re_pwd })
